package myJs.myPkg

import scala.scalajs.js
import myJs.myPkg.jquery.JQuery
import slinky.readwrite.ObjectOrWritten

import scala.scalajs.js.annotation.JSImport
import scala.scalajs.js.|

/**
 * Created by yz on 2019/3/14
 */

case class LayerOptions(
                         title: js.UndefOr[String] = js.undefined,
                         icon: js.UndefOr[Int] = js.undefined,
                         time: js.UndefOr[Int] = js.undefined,
                         closeBtn: js.UndefOr[Int] = js.undefined,
                         skin: js.UndefOr[String] = js.undefined,
                         btn: js.UndefOr[List[Int]] = js.undefined,
                         `type`: js.UndefOr[Int] = js.undefined,
                         area: js.UndefOr[String | js.Array[String]] = js.undefined,
                         anim: js.UndefOr[Int] = js.undefined,
                         shadeClose: js.UndefOr[Boolean] = js.undefined,
                         maxmin: js.UndefOr[Boolean] = js.undefined,
                         content: js.UndefOr[String | JQuery] = js.undefined,
                         shade: js.UndefOr[List[String]] = js.undefined
                       )


@JSImport("layer-src", JSImport.Default)
@js.native
object layer extends js.Object {

  def alert(element: String, options: ObjectOrWritten[LayerOptions]): Int = js.native

  def open(options: LayerOptions): Int = js.native

  def close(index: Int): Unit = js.native

  def confirm(element: String, options: LayerOptions, yes: js.Function, cancel: js.Function): Int = js.native

  def msg(element: String, options: LayerOptions): Int = js.native

  def load(icon: Int, options: LayerOptions): Int = js.native

}
